#ifndef __UART_EXCHANGE_H
#define __UART_EXCHANGE_H

#include "stm32f10x.h"
#include "misc.h"
#include "board.h"
#include "kservice.h"

#define COM_EXCHANGE_UART_PORT       (USART2)

#define COM_EXCHANGE_UART_RCC        RCC_APB1Periph_USART2
#define COM_EXCHANGE_UART_RCC_GPIO   RCC_APB2Periph_GPIOA
#define COM_EXCHANGE_UART_GPIO_TX	   GPIO_Pin_2
#define COM_EXCHANGE_UART_GPIO_RX	   GPIO_Pin_3
#define COM_EXCHANGE_UART_GPIO		   GPIOA

#define COM_EXCHANGE_UART_BAUD       (115200)

typedef void (*com_exchange_cb_t)(unsigned char ch);
void com_exchange_console_register_callback(com_exchange_cb_t cb);

void com_exchange_console_init(void);
void com_exchange_console_put_byte(unsigned char ch);

void exchange_printf(unsigned char *data, unsigned int len);

#endif
